<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>教师后台-添加系部</title>
    <style>
        /* .container {
            min-height: 100vh;
        } */

        /* .container .nav {
            height: 100vh;
            background-color: #fff;
        } */

        .container .leftmenu {
            min-height: 100vh;
            background-color: #fff;
        }

        .link-secondary {
            text-decoration: none;
        }

        .link-secondary:hover {
            color: #cd70e2 !important;
        }
    </style>
</head>
<body>
    <!-- container是bootstrap的居中窄的显示方案 -->
    <div class="container bg-body-secondary">
        <div class="row">
            <div class="col-md-2 leftmenu" id="leftmenu"></div>
            <div class="col-md-9 kc ms-3">
                <div class="row mt-3 pb-1 border-bottom border-info">
                    <div class="col-md-2">添加系部</div>
                    <div class="col-md-1 offset-md-8">
                        <a class="nav-link link-success" href="JavaScript:history.go(-1)">返回</a>
                    </div>
                </div>
                <div class="row mt-3">
                    <form>
                        <div class="mb-3 row">
                            <label for="department_name" class="col-sm-2 col-form-label">系部名称:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="department_name">
                            </div>
                        </div>
                        <div class="mb-3 row">
                            <label for="department_code" class="col-sm-2 col-form-label">系部编号码:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="department_code">
                            </div>
                        </div>
                        <div class="mb-3 row">
                            <label for="school_code" class="col-sm-2 col-form-label">学校编号码:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="school_code">
                            </div>
                        </div>
                        <div class="mb-3 row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-outline-primary">提交:</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script type="module" src="../js/main.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/common.js"></script>
    <script>
        $(document).ready(function () {
            $(".btn-outline-primary").click(function () {
                let department_name = $("#department_name").val() //系部名称
                let department_code = $("#department_code").val() //系部编号码
                let school_code = $("#school_code").val()  //学校编号码

                $.post("http://unicloud.codecore.cn/ms/departCreate", {
                    department_name: department_name,
                    department_code: department_code,
                    school_code: school_code
                }, function (params) {
                    if (params.errCode == 0) {
                        location.href = "./depart.html"
                    } else {
                        alert("添加失败")
                    }
                })
            })
        })
    </script>
</body>
</html>